import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    id: execCmd
    visible: false
    width: 320
    height: 160

    signal click_result()
    property string resultStr: ""
    property string titleText: qsTr("title") // 定义 title 的文本属性

    Rectangle {
        id: rectangle
        anchors.fill: parent
        color: "#FFFFE0"

        Text {
            id: title
            x:10
            y:5
            width: 50
            height: 20
            text: titleText
        }

        property real halveWidth: width / 9
        property real halveHeight: height / 7
        property real buttonWidth: halveWidth * 3
        property real buttonHeight: halveHeight * 2

        Button {

            width: rectangle.buttonWidth
            height: rectangle.buttonHeight
            x: rectangle.halveWidth
            y: rectangle.halveHeight

            text: "启动"

            onClicked: {
                resultStr = "start"
                click_result()
            }
        }

        Button {
            width: rectangle.buttonWidth
            height: rectangle.buttonHeight
            x: rectangle.halveWidth * 5
            y: rectangle.halveHeight

            text: "返回"

            onClicked: {
                resultStr = "return"
                click_result()
            }
        }

        Button {
            width: rectangle.buttonWidth
            height: rectangle.buttonHeight
            x: rectangle.halveWidth
            y: rectangle.halveHeight * 4

            text: "修改"

            onClicked: {
                resultStr = "update"
                click_result()
            }
        }

        Button {
            width: rectangle.buttonWidth
            height: rectangle.buttonHeight
            x: rectangle.halveWidth * 5
            y: rectangle.halveHeight * 4

            text: "删除"

            onClicked: {
                resultStr = "delete"
                click_result()
            }
        }
    }
}
